<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div class="app">
        <h1>{{this.$store.state.a}}</h1>
        <h2>{{this.$store.getters.totalPrice}}</h2>
        <button @click='dian1'>+1</button>
    </div>
    <script src="./node_modules/vue/dist/vue.js"></script>
    <script src="./node_modules/vuex/dist/vuex.js"></script>
    <script src="./node_modules/axios/dist/axios.js"></script>
    <script>
        const store = new Vuex.Store({ 
            getters:{
                totalPrice:(state)=>{
                    return state.a * 10
                }
            },
            state:{
                a:111
            },
            mutations:{
                dian:function(state){
                    state.a++
                }
            },
            actions:{
                asyncIncrement:function(store){
                    axios.get('').then()
                }
            }
        })
        let aa = new Vue({
            store,
            el:'.app',
            methods:{
                dian1:function(){
                    this.$store.commit('dian')
                },
                yibu:function(){
                    this.$store.dispatch('asyncIncrement')
                }
            }
        })
    </script>
</body>
</html>